package com.uniview.dao;

import com.uniview.base.BaseDao;
import com.uniview.entity.po.OrderLastRegion;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("orderLastRegionDao")
public class OrderLastRegionDao extends BaseDao<OrderLastRegion> {


    /**
     * 获取默认办事处
     */
    public OrderLastRegion findByCreator(String creator) throws Exception{
        String sql = "SELECT * FROM sd_order_last_region WHERE UPPER(creator) = '" + creator.toUpperCase() + "'";
        List<OrderLastRegion> list = this.findBySql(sql);
        if (null != list && list.size() > 0) {
            return list.get(0);
        }
        return null;
    }

    /**
     * 保存
     */
    public void saveRegion(OrderLastRegion orderLastRegion) throws Exception {
        this.save(orderLastRegion);
    }

    /**
     * 更新
     */
    public void updateRegion(OrderLastRegion orderLastRegion) throws Exception {
        this.update(orderLastRegion);
    }
}
